package com.flca.frw.validator
{
	import mx.validators.Validator;
	import mx.validators.ValidationResult;
	import com.flca.frw.util.ConversionUtil;
	import mx.controls.Alert;

/*
exmple how to use:
	<vld:ComboboxValidator id="vldWoonsituatie" source="{cbWoonsituatie}" property="text" required="true" enabled="false"/>
*/
	public class ComboboxValidator extends Validator
	{
		
		private var results:Array;

		public function ComboboxValidator() 
		{
			super();
		}
		
	    override protected function doValidation(value : Object):Array 
	    {
		    // Clear results Array.
		    results = [];
		
		    // Call base class doValidation().
		    results = super.doValidation(value);        
		    if (results.length > 0)
		        return results;
		
			var s:String = value as String;
			if (s.substr(0, 4) == "Kies") {
		        results.push(
		        	new ValidationResult(true, null, "Checkbox", 
		            "dit veld is verplicht."));
		        return results;
			}

		    return results;
		}
	}
}

